package util;

import java.util.*;
import model.*;

public class JavascriptUtil {
	public static <T extends IModel> String genJavascriptIdArray(List<T> list) {
		StringBuffer sb = new StringBuffer();
		sb.append("[");

		for (int i = 0; i < list.size(); i++) {
			T t = list.get(i);
			if (i > 0) {
				sb.append(", ");
			}
			sb.append("'" + t.getId() + "'");
		}

		sb.append("]");
		return sb.toString();
	}
}
